package com.xunwulian.dubbo;

import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication(scanBasePackages="com.xunwulian")
@MapperScan("com.xunwulian.base.dao")
@EnableDubbo
public class DubboApplication {

    public static void main(String[] args) {
        SpringApplication.run(DubboApplication.class, args);
        try {
            Thread.sleep(3600 * 1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
//
//    @Override
//    public void run(String... args) throws Exception {
//        Logger logger = LoggerFactory.getLogger(DubboApplication.class);
//        // 获取环境变量
//        String appId = System.getenv("appId");
//        if (appId == null || "".equals(appId)) {
//            appId = "mock";
//        }
//        logger.info("appId:" + appId);
//        String registryAddress = System.getenv("registry");
//        if (registryAddress == null || "".equals(registryAddress)) {
//            registryAddress = "zookeeper://127.0.0.1:2181";
//        }
//        logger.info("registry:" + registryAddress);
//
//        dubboProvider.runDubboServer(appId, registryAddress);
//
//    }

}